package com.yangzhipeng.service.impl;

import com.yangzhipeng.entity.User;
import com.yangzhipeng.repository.UserRepository;
import com.yangzhipeng.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserRepository userRepository;


    @Override
    public Optional<User> getUserByid(Integer id) {
        return userRepository.findById(id);
    }

    @Override
    public List<User> getUserAll() {
        return userRepository.findAll();
    }
}
